#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "units.h"

STroup * new_troup(int idCell, int idUnit, int idTeam, EUnitType type) {
	STroup * troup = malloc(sizeof(STroup));
	
	if (troup) {
		troup->idUnit = idUnit;
		troup->idTeam = idTeam;
		troup->idCell = idCell;
		troup->u_type = type;
	} else {
		exit(fprintf(stderr, "In new_troup : failed to allocate memory.\n"));
	}

	return troup;
}

void print_unit(STroup * troup) {
	printf("(%d, %d, ", troup->idUnit, troup->idTeam);
	switch (troup->u_type) {
		case UT_Army:
			printf("Army) ");
			break;
		case UT_Fleet:
			printf("Fleet) ");
			break;
		default:
			break;
	}
}